package com.ysb.hbase.dml;

import com.ysb.hbase.model.*;

import java.util.List;
import java.util.Map;

public interface DmlService {

    /**
     * 根据rowKey获得一条数据，返回 ValueModel
     * <p>
     * tableName, rowKey, columnFamily, qualifier 都必填
     *
     * @param getParam getParam
     * @return ValueModel
     */
    ValueModel getValue(HbaseGetParam getParam);

    ValueModel getValueMd5(HbaseGetParam getParam);


    /**
     * 根据rowKey获得一条数据，返回具体的value值
     * <p>
     * tableName, rowKey, columnFamily, qualifier 都必填
     *
     * @param getParam getParam
     * @return ValueModel
     */
    byte[] getValueByte(HbaseGetParam getParam);

    byte[] getValueByteMd5(HbaseGetParam getParam);


    /**
     * 根据rowKey获得数据列表，返回 List<ValueModel>
     * <p>
     * tableName, rowKey, 必填
     * columnFamily, qualifier 选填
     *
     * @param getParam getParam
     * @return HbaseGetResult
     */
    List<ValueModel> getValueList(HbaseGetRowParam getParam);

    List<ValueModel> getValueListMd5(HbaseGetRowParam getParam);


    <T> T getRowObj(HbaseGetRowParam getParam, Class<T> t) throws Exception;

    <T> T getRowObjMd5(HbaseGetRowParam getParam, Class<T> t) throws Exception;

    /**
     * 根据多个 rowKey获取数据，返回 list
     * tableName，columnFamily，rowKeyList 必填。
     * <p>
     * 这里在获取数据的时候，会转换成md5
     *
     * @param param param
     * @return List<RowModel>
     */
    List<RowModel> batchGet(HbaseBatchGetParam param);

    List<RowModel> batchGetMd5(HbaseBatchGetParam param);


    /**
     * 根据多个 rowKey 获取数据，返回 map:<rowKey, List<ValueModel>>
     * tableName，columnFamily，rowKeyList 必填。
     *
     * @param getParam getParam
     * @return List<RowModel>
     */
    Map<String, List<ValueModel>> batchGetMap(HbaseBatchGetParam getParam);

    Map<String, List<ValueModel>> batchGetMapMd5(HbaseBatchGetParam getParam);


    /**
     * 根据多个 rowKey 获取数据，返回 map:<rowKey, T>
     * tableName，columnFamily，rowKeyList 必填。
     *
     * @param getParam getParam
     * @return List<RowModel>
     */
    <T> Map<String, T> batchGetMap(HbaseBatchGetParam getParam, Class<T> t);

    <T> Map<String, T> batchGetMapMd5(HbaseBatchGetParam getParam, Class<T> t);


    boolean putData(HbasePutParam putParam);

    boolean putDataMd5(HbasePutParam putParam);


    boolean batchPut(HbaseBatchPutParam param);

    boolean batchPutMd5(HbaseBatchPutParam param);


}
